/******************************************************************************
 * Copyright (C) 2024 EternalChip, Inc.(Gmbh) or its affiliates.
 *
 * All Rights Reserved.
 *
 * @file
 *
 * @par dependencies
 * -
 * -
 * -
 *
 * @author
 *
 * @brief
 *
 * Processing flow:
 *
 * call directly.
 *
 * @version
 *
 *****************************************************************************/

#include <stdarg.h>
#include <stdio.h>

#include "main.h"

#include "gpio.h"

#include "log.h"

/*********************************************************************************************************
 *                                  MyPrintf()
 *
 * @brief
 *
 * @param   void
 *
 * @retval  void
 *
 * @note    None.
 ********************************************************************************************************/
void MyPrintf(UART_HandleTypeDef *huart, const char *pFormat, ...)
{
    char     Buf[BUF_SIZE + 1];
    uint32_t u32Buf_ValidSize;
    va_list  Arg_List;

    va_start(Arg_List, pFormat);

    u32Buf_ValidSize = vsnprintf(Buf, sizeof(Buf), pFormat, Arg_List);

    va_end(Arg_List);

    HAL_UART_Transmit_DMA(huart, (uint8_t *)Buf, u32Buf_ValidSize);
}
